﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace Subtle.Data.Extensions
{
	/// <summary>
	/// String Extension Methods
	/// </summary>
	public static class StringExtensionMethods
	{
		/// <summary>
		/// Sanitize the string, make sure no illegal characters exist
		/// </summary>
		/// <param name="stringToSanitize"></param>
		/// <returns></returns>
		public static string Sanitize(this string stringToSanitize)
		{
			stringToSanitize = stringToSanitize.Trim();
			string[] illegalCharacters = new string[] { ",", "\'", "?", " ", ".", "/" };
			foreach (string illegalCharacter in illegalCharacters)
			{
				stringToSanitize = stringToSanitize.Replace(illegalCharacter, String.Empty);
			}
			return stringToSanitize.Trim();
		}
	}
}
